<?php 
class Db_attribute extends MVC_SQL {
	public function __construct(){
		$this->setTable('attribute');
	}
	public function getdataAttribute($oModel)
	{
		$sql = "SELECT * FROM attribute ORDER BY at_id DESC";
		return  $this->getRecordsetExtend($sql);
	}
	public function delete_att($at_id){
		$sql = "DELETE FROM attribute WHERE at_id ='{$at_id}' ";
		return  $this->db_query($sql);
	}
	//lay ra thong tin cua attribute cho viec update sau
	public function getInfoAttribute($at_id)
	{
		$sql="SELECT * FROM attribute WHERE at_id='{$at_id}'";
		return  $this->getRecordsetExtend($sql);	
	}	
	public function insert_att($att_name,$att_content,$att_status)
	{
		$sql="INSERT INTO attribute(at_name,at_content,at_status) VALUES ('$att_name','$att_content','$att_status') ";
		//echo $sql;
		//die();
		return  $this->db_query($sql);	
	}
	public function update_att($att_id,$att_name,$att_content,$att_status)
	{
		echo $sql="UPDATE attribute SET at_name='{$att_name}',at_status='{$att_status}', at_content='{$att_content}' WHERE at_id={$att_id} ";
		//echo $sql;
		//die();
		return  $this->db_query($sql);	
	}
}
?>
